#covid2020Count_abandonded.py
#method to count the specific messages by tech center and month 
#written by Nick Shine
#November 2020

import json

numberOfMonths = 12
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

#dictionaires to hold the sorted data
appInfoJan = {}
appInfoFeb = {}
appInfoMar = {}
appInfoApr = {}
appInfoMay = {}
appInfoJun = {}
appInfoJul = {}
appInfoAug = {}
appInfoSep = {}
appInfoOct = {}
appInfoNov = {}
appInfoDec = {}

appInfoMonths = [appInfoJan,
				 appInfoFeb,
				 appInfoMar,
				 appInfoApr,
				 appInfoMay,
				 appInfoJun,
				 appInfoJul,
				 appInfoAug,
				 appInfoSep,
				 appInfoOct,
				 appInfoNov,
				 appInfoDec]

#status messages of interest
abandonedReason1 = 'Abandoned  --  Failure to Respond to an Office Action'
abandonedReason2 = 'Expressly Abandoned  --  During Examination'
abandonedReason3 = 'Abandoned  --  Incomplete Application (Pre-examination)'
abandonedReason4 = 'Abandoned  --  Failure to Pay Issue Fee'
abandonedReason5 = 'Abandonment for Failure to Correct Drawings/Oath/NonPub Request'
abandonedReason6 = 'Expressly Abandoned  --  During Publication Process'
abandonedReason7 = 'Abandoned  --  After Examiner\'s Answer or Board of Appeals Decision'
withdrawnAbandonment = 'Withdrawn Abandonment, awaiting examiner action'
patentedCase = 'Patented Case'
patentExpiredNoFees = 'Patent Expired Due to NonPayment of Maintenance Fees Under 37 CFR 1.362'
docketedNewCase = 'Docketed New Case - Ready for Examination'
nfoaMailed = 'Non Final Action Mailed'
responseToNfoa = 'Response to Non-Final Office Action Entered and Forwarded to Examiner'
finalRejecMailed = 'Final Rejection Mailed'
responseToFinalAction = 'Response after Final Action Forwarded to Examiner'

#loop to open the json month files for the year and to
#orgainze the data into respective tech centers based on the type of messages
#and the art unit.
for x in range(len(months)):


	appInfoContainer = appInfoMonths[x]

	monthJSONfile = months[x] + '2020combined.json'

	with open(monthJSONfile, 'r', encoding='utf-8') as json_file:
		data = json.load(json_file)
		totalNumberOfAppsCount = 0	

	for i in data:

		#--------------------TechCenter 1600--------------------------------------------------
		if data[i]['ArtUnit'][0:2] == '16':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1600, 'Status' : 'Other'}

		#--------------------TechCenter 1700-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '17':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 1700, 'Status' : 'Other'}

		#--------------------TechCenter 2100-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '21':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2100, 'Status' : 'Other'}

		#--------------------TechCenter 2400-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '24':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2400, 'Status' : 'Other'}

		#--------------------TechCenter 2600-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '26':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2600, 'Status' : 'Other'}

		#--------------------TechCenter 2800-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '28':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2800, 'Status' : 'Other'}

		#--------------------TechCenter 2900-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '29':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 2900, 'Status' : 'Other'}

		#--------------------TechCenter 3600-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '36':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3600, 'Status' : 'Other'}

		#--------------------TechCenter 3700-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '37':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3700, 'Status' : 'Other'}

		#--------------------TechCenter 3900-------------------------------------------------- 
		elif data[i]['ArtUnit'][0:2] == '39':
			
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 3900, 'Status' : 'Other'}
		else:
			if data[i]['Status'] == (abandonedReason1 or 
									 abandonedReason2 or 
									 abandonedReason3 or 
									 abandonedReason4 or 
									 abandonedReason5 or
									 abandonedReason6 or
									 abandonedReason7):
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'Abandoned'}

			elif data[i]['Status'] == withdrawnAbandonment:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'Withdrawn'}

			elif data[i]['Status'] == patentedCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'Patented'}

			elif data[i]['Status'] == patentExpiredNoFees:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'Expired'}

			elif data[i]['Status'] == docketedNewCase:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'NewCase'}

			elif data[i]['Status'] == nfoaMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'NFOA'}

			elif data[i]['Status'] == responseToNfoa:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'NFOAresponse'}

			elif data[i]['Status'] == finalRejecMailed:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'CTFR'}

			elif data[i]['Status'] == responseToFinalAction:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'CTFRresponse'}
			else:
				containerIndex = (len(appInfoContainer))
				appInfoContainer[containerIndex] = {'TechCenter' : 'Other', 'Status' : 'Other'}


#print(appInfoJan, '\n')
#print(len(appInfoJan), '\n','\n','\n','\n','\n')
#print(appInfoFeb, '\n')
#print(len(appInfoFeb), '\n')

print('Jan number is:', len(appInfoJan), '\n')
print('Feb number is:', len(appInfoFeb), '\n')
print('Mar number is:', len(appInfoMar), '\n')
print('Apr number is:', len(appInfoApr), '\n')
print('May number is:', len(appInfoMay), '\n')
print('Jun number is:', len(appInfoJun), '\n')
print('Jul number is:', len(appInfoJul), '\n')
print('Aug number is:', len(appInfoAug), '\n')
print('Sep number is:', len(appInfoSep), '\n')
print('Oct number is:', len(appInfoOct), '\n')
print('Nov number is:', len(appInfoNov), '\n')
print('Dec number is:', len(appInfoDec), '\n')
			
#variables to hold the message counts of interest
allAbandonedTotalCount = 0
allWithdrawnTotalCount = 0
allExpiredTotalCount = 0
allOaTotalCount = 0
allOaResponseTotalCount = 0

techCentersList= ['tc1600',
				  'tc1700',
				  'tc2100',
				  'tc2400',
				  'tc2600',
				  'tc2800',
				  'tc2900',
				  'tc3600',
				  'tc3700',
				  'tc3900',
				  'tcOther']

#loop to count the messages for each tech center for each month
for x in range(len(appInfoMonths)):

	appInfoContainer = appInfoMonths[x]
	
	tc1600AppsAbandonedCount = 0
	tc1700AppsAbandonedCount = 0
	tc2100AppsAbandonedCount = 0
	tc2400AppsAbandonedCount = 0
	tc2600AppsAbandonedCount = 0
	tc2800AppsAbandonedCount = 0
	tc2900AppsAbandonedCount = 0
	tc3600AppsAbandonedCount = 0
	tc3700AppsAbandonedCount = 0
	tc3900AppsAbandonedCount = 0
	tcOtherAppsAbandonedCount = 0

	tc1600AppsWithdrawnCount = 0
	tc1700AppsWithdrawnCount = 0
	tc2100AppsWithdrawnCount = 0
	tc2400AppsWithdrawnCount = 0
	tc2600AppsWithdrawnCount = 0
	tc2800AppsWithdrawnCount = 0
	tc2900AppsWithdrawnCount = 0
	tc3600AppsWithdrawnCount = 0
	tc3700AppsWithdrawnCount = 0
	tc3900AppsWithdrawnCount = 0
	tcOtherAppsWithdrawnCount = 0

	tc1600AppsExpiredCount = 0
	tc1700AppsExpiredCount = 0
	tc2100AppsExpiredCount = 0
	tc2400AppsExpiredCount = 0
	tc2600AppsExpiredCount = 0
	tc2800AppsExpiredCount = 0
	tc2900AppsExpiredCount = 0
	tc3600AppsExpiredCount = 0
	tc3700AppsExpiredCount = 0
	tc3900AppsExpiredCount = 0
	tcOtherAppsExpiredCount = 0

	tc1600AppsOACount = 0
	tc1700AppsOACount = 0
	tc2100AppsOACount = 0
	tc2400AppsOACount = 0
	tc2600AppsOACount = 0
	tc2800AppsOACount = 0
	tc2900AppsOACount = 0
	tc3600AppsOACount = 0
	tc3700AppsOACount = 0
	tc3900AppsOACount = 0
	tcOtherAppsOACount = 0

	tc1600AppsOAresponseCount = 0
	tc1700AppsOAresponseCount = 0
	tc2100AppsOAresponseCount = 0
	tc2400AppsOAresponseCount = 0
	tc2600AppsOAresponseCount = 0
	tc2800AppsOAresponseCount = 0
	tc2900AppsOAresponseCount = 0
	tc3600AppsOAresponseCount = 0
	tc3700AppsOAresponseCount = 0
	tc3900AppsOAresponseCount = 0
	tcOtherAppsOAresponseCount = 0	

	for i in range(len(appInfoContainer)):
		if (appInfoContainer[i]['TechCenter'] == 1600):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc1600AppsAbandonedCount += 1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc1600AppsWithdrawnCount += 1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc1600AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc1600AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc1600AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 1700):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc1700AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc1700AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc1700AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc1700AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc1700AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 2100):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc2100AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc2100AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc2100AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc2100AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc2100AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 2400):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc2400AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc2400AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc2400AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc2400AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc2400AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 2600):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc2600AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc2600AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc2600AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc2600AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc2600AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 2800):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc2800AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc2800AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc2800AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc2800AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc2800AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 2900):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc2900AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc2900AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc2900AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc2900AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc2900AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 3600):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc3600AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc3600AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc3600AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc3600AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc3600AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 3700):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc3700AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc3700AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc3700AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc3700AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc3700AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 3900):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tc3900AppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tc3900AppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tc3900AppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tc3900AppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tc3900AppsOAresponseCount += 1

		elif (appInfoContainer[i]['TechCenter'] == 'Other'):

			if(appInfoContainer[i]['Status'] == 'Abandoned'):
				tcOtherAppsAbandonedCount +=1
			elif(appInfoContainer[i]['Status'] == 'Withdrawn'):
				tcOtherAppsWithdrawnCount +=1
			elif(appInfoContainer[i]['Status'] == 'Expired'):
				tcOtherAppsExpiredCount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOA') or (appInfoContainer[i]['Status'] == 'CTFR')):
				tcOtherAppsOACount += 1
			elif((appInfoContainer[i]['Status'] == 'NFOAresponse') or (appInfoContainer[i]['Status'] == 'CTFRresponse')):
				tcOtherAppsOAresponseCount += 1


#code to print out the results
	abandondedTcCounted = [tc1600AppsAbandonedCount,
	                       tc1700AppsAbandonedCount,
	                       tc2100AppsAbandonedCount,
						   tc2400AppsAbandonedCount,
						   tc2600AppsAbandonedCount,
						   tc2800AppsAbandonedCount,
						   tc2900AppsAbandonedCount,
						   tc3600AppsAbandonedCount,
						   tc3700AppsAbandonedCount,
						   tc3900AppsAbandonedCount,
						   tcOtherAppsAbandonedCount]

	abandonedTotalCount = 0

	for j in range(len(techCentersList)):

		#print('The number of', techCentersList[j], 'apps abandoned in', months[x], '2020 is:', abandondedTcCounted[j], '\n')

		abandonedTotalCount += abandondedTcCounted[j] 

	print('The total number of apps abandoned in', months[x], '2020 is:', abandonedTotalCount, '\n')

	print('------------------------------------------------------------------------------------\n')

	withdrawnTcCounted = [tc1600AppsWithdrawnCount, 
						  tc1700AppsWithdrawnCount,
						  tc2100AppsWithdrawnCount, 
						  tc2400AppsWithdrawnCount, 
						  tc2600AppsWithdrawnCount, 
						  tc2800AppsWithdrawnCount, 
						  tc2900AppsWithdrawnCount, 
						  tc3600AppsWithdrawnCount, 
						  tc3700AppsWithdrawnCount, 
						  tc3900AppsWithdrawnCount, 
						  tcOtherAppsWithdrawnCount]

	withdrawnTotalCount = 0

	for j in range(len(techCentersList)):

		#print('The number of', techCentersList[j], 'apps withdrawn from abandonment in', months[x], '2020 is:', withdrawnTcCounted[j], '\n')

		withdrawnTotalCount += withdrawnTcCounted[j] 

	print('The total number of apps withdrawn from abandonment in', months[x], '2020 is:', withdrawnTotalCount, '\n')

	print('------------------------------------------------------------------------------------\n')

	expiredTcCounted = [tc1600AppsExpiredCount,
						tc1700AppsExpiredCount, 
						tc2100AppsExpiredCount, 
						tc2400AppsExpiredCount, 
						tc2600AppsExpiredCount, 
						tc2800AppsExpiredCount, 
						tc2900AppsExpiredCount, 
						tc3600AppsExpiredCount,
						tc3700AppsExpiredCount, 
						tc3900AppsExpiredCount, 
						tcOtherAppsExpiredCount]

	expiredTotalCount = 0


	for j in range(len(techCentersList)):

		#print('The number of', techCentersList[j], 'apps expired in', months[x], '2020 is:', expiredTcCounted[j], '\n')

		expiredTotalCount += expiredTcCounted[j] 

	print('The total number of apps expired in', months[x], '2020 is:', expiredTotalCount, '\n')

	print('------------------------------------------------------------------------------------\n')

	oaTcCounted = [tc1600AppsOACount,
				   tc1700AppsOACount,
				   tc2100AppsOACount,
				   tc2400AppsOACount,
				   tc2600AppsOACount,
				   tc2800AppsOACount,
				   tc2900AppsOACount,
				   tc3600AppsOACount,
				   tc3700AppsOACount,
				   tc3900AppsOACount,
				   tcOtherAppsOACount]

	oaTotalCount = 0


	for j in range(len(techCentersList)):

		#print('The number of', techCentersList[j], 'apps with and office action in', months[x], '2020 is:', oaTcCounted[j], '\n')

		oaTotalCount += oaTcCounted[j] 

	print('The total number of apps with and office action in', months[x], '2020 is:', oaTotalCount, '\n')

	print('------------------------------------------------------------------------------------\n')

	oaResponseTcCounted = [tc1600AppsOAresponseCount,
						   tc1700AppsOAresponseCount,
						   tc2100AppsOAresponseCount,
						   tc2400AppsOAresponseCount,
						   tc2600AppsOAresponseCount,
						   tc2800AppsOAresponseCount,
						   tc2900AppsOAresponseCount,
						   tc3600AppsOAresponseCount,
						   tc3700AppsOAresponseCount,
						   tc3900AppsOAresponseCount,
						   tcOtherAppsOAresponseCount]

	oaResponseTotalCount = 0


	for j in range(len(techCentersList)):

		#print('The number of', techCentersList[j], 'apps with and office action response in', months[x], '2020 is:', oaResponseTcCounted[j], '\n')

		oaResponseTotalCount += oaResponseTcCounted[j] 

	print('The total number of apps with and office action response in', months[x], '2020 is:', oaResponseTotalCount, '\n')

	print('------------------------------------------------------------------------------------\n')

	allAbandonedTotalCount += abandonedTotalCount
	allWithdrawnTotalCount += withdrawnTotalCount
	allExpiredTotalCount += expiredTotalCount
	allOaTotalCount += oaTotalCount
	allOaResponseTotalCount += oaResponseTotalCount

print('Overall Abandonded Total is:', allAbandonedTotalCount, '\n')
print('Overall Withdrawn Total is:', allWithdrawnTotalCount, '\n')
print('Overall Expired Total is:', allExpiredTotalCount, '\n')
print('Overall OA Total is:', allOaTotalCount, '\n')
print('Overall OA Response Total is:', allOaResponseTotalCount, '\n')